package cart.haiboinvest.com.haibocart.ui.activity.account;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import cart.haiboinvest.com.haibocart.R;


/**登陆界面
 * Created by quan on 2016/4/14.
 */
public class LoginActivity extends Activity implements View.OnClickListener {
    private Button btLogin;
    private Button btRegister;
    private TextView tvForgetPwd;



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
        findViews();
    }

    private void findViews() {
        btLogin= (Button) findViewById(R.id.btn_login);
        btRegister= (Button) findViewById(R.id.btn_register);
        btLogin.setOnClickListener(this);
        btRegister.setOnClickListener(this);
        tvForgetPwd= (TextView) findViewById(R.id.tv_forget_password);
        tvForgetPwd.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        int viewId=view.getId();
        switch (viewId){
            case R.id.btn_login:
                jumpToHome();
                break;
            case R.id.btn_register:
                jumpToRegister();
                break;
            case R.id.tv_forget_password:
                jumpToForgetPwd();
                break;
        }
    }

    private void jumpToForgetPwd() {
        Intent intent=new Intent(this,RetrievePasswordActivity.class);
        startActivity(intent);

    }

    private void jumpToHome() {
        Intent intent=new Intent(this,HomeActivity.class);
        startActivity(intent);
        finish();
    }

    private void jumpToRegister() {
        Intent intent=new Intent(this,RegisterActivity.class);
        startActivity(intent);

    }
}
